<template>
	<div class="detail_box" v-if="isShowDetail">
		<div class="detail_title">
			<img class="title" src="../../image/icon_buss_detail_title.png" />
			<img class="close" src="../../image/icon_close.png" @click="handleClose" />
		</div>
		<div class="detail_intro" v-if="detailInfo">
			<img src="../../image/icon_header.jpg" />
			<div class="intro">
				<div class="name">江山市富美新塘集体经济发展有限公司</div>
				<div class="info">
					江山市富美新塘集体经济发展有限公司是浙江省江山市主营茶叶销售的企业，经营绿茶等系列产品。其中共富茶园项目是推动新塘边镇茶叶生产向规模化、产业化发展，不仅是村民致富增收的有效途径，更是推进现代农业发展、实施乡村振兴战略的重要抓手。
				</div>
			</div>
		</div>
		<div class="detail_stat" v-if="detailInfo">
			<img class="stat_subtitle" src="../../image/icon_cpgmzl.png" alt="" />
			<img class="stat_line" src="../../image/icon_line.png" alt="" />
			<div class="stat_info">
				<div class="stat_info_item">
					<img src="../../image/icon_info_left.png" alt="" />
					<div class="right">
						<div>茶园面积</div>
						<div>600亩</div>
					</div>
				</div>
				<div class="stat_info_item">
					<img src="../../image/icon_info_left.png" alt="" />
					<div class="right">
						<div>厂房面积</div>
						<div>2000㎡</div>
					</div>
				</div>
				<!-- <div class="stat_info_item">
                    <img src="../../image/icon_info_left.png" alt="">
                    <div class="right">
                        <div>年产量</div>
                        <div>10吨</div>
                    </div>
                </div> -->
				<div class="stat_info_item">
					<img src="../../image/icon_info_left.png" alt="" />
					<div class="right">
						<div>年产值</div>
						<div>300万</div>
					</div>
				</div>
			</div>
			<div class="stat_type">
				<div class="title">茶叶种类</div>
				<div class="type_item">绿茶</div>
			</div>
			<img class="stat_subtitle" src="../../image/icon_trfl.png" alt="" />
			<img class="stat_line" src="../../image/icon_line.png" alt="" />

			<div class="stat_table">
				<div class="stat_table_cell table_header">
					<div style="width: 60px">序号</div>
					<div style="width: 66px">PH值</div>
					<div style="width: 76px">有机质</div>
					<div style="width: 76px">铵态氮</div>
					<div style="width: 76px">有效钾</div>
					<div style="width: 76px">速效磷</div>
					<div>测土时间</div>
				</div>
				<div class="stat_table_cell" v-for="(item, index) in detailInfo.tableArray" :key="index">
					<div style="width: 60px">{{ index + 1 }}</div>
					<div style="width: 66px">{{ item.value1 }}</div>
					<div style="width: 76px">{{ item.value2 }}</div>
					<div style="width: 76px">{{ item.value3 }}</div>
					<div style="width: 76px">{{ item.value4 }}</div>
					<div style="width: 76px">{{ item.value5 }}</div>
					<div>{{ item.value6 }}</div>
				</div>
			</div>

			<img class="stat_subtitle" src="../../image/icon_scsb.png" alt="" />
			<img class="stat_line" src="../../image/icon_line.png" alt="" />
			<div class="stat_device">
				<div class="device_item" v-for="(item, index) in detailInfo.deviceList" :key="index">
					<img :src="item.imgUrl" alt="" />
					<div>{{ item.name }}</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script setup lang='ts'>
import { ref, reactive } from 'vue';

const detailInfo = ref();
const isShowDetail = ref(false);
/**
 * 获取详情
 * @param row
 */
const getDetailInfo = (row: any) => {
    if(isShowDetail.value) return
	isShowDetail.value = true;
	detailInfo.value = {
		tableArray: [
			{
				value1:5.9,
				value2:28.6,
				value3:39.2,
				value4:102,
				value5:16.5,
				value6:'2025-07-25'
			},
			{
				value1:5.7,
				value2:32.1,
				value3:42.5,
				value4:115,
				value5:12.8,
				value6:'2025-07-25'
			},
			{
				value1:5.6,
				value2:25.4,
				value3:36.9,
				value4:98,
				value5:14.3,
				value6:'2025-07-25'
			},
			{
				value1:5.4,
				value2:30.5,
				value3:40.7,
				value4:108,
				value5:13.6,
				value6:'2025-07-25'
			},
		],
		deviceList: [
			{
				imgUrl: new URL('../../image/business_device_1.png', import.meta.url),
				name: '微波茶叶杀青设备',
			},
			{
				imgUrl: new URL('../../image/business_device_2.png', import.meta.url),
				name: '茶叶揉捻机',
			},
			{
				imgUrl: new URL('../../image/business_device_3.png', import.meta.url),
				name: '茶叶磁选机',
			},
		],
	};
};
onMounted(() => {
});

const handleClose = () => {
	isShowDetail.value = false;
};

defineExpose({
	getDetailInfo,
});
</script>
<style lang='less' scoped>
@import url('../../index.less');
.detail_box {
	width: 620px;
	max-height: calc(100% - 60px);
	overflow-y: auto;
	background: url('../../image/icon_box_bg_2.png') no-repeat;
	background-size: 100% 100%;
	padding: 8px;
	box-sizing: border-box;
	margin-top: 16px;
	.detail_title {
		height: 50px;
		width: 100%;
		background: url('../../image/icon_title_bg_2.png') no-repeat;
		background-size: 100% 100%;
		box-sizing: border-box;
		padding-left: 46px;
		line-height: 50px;
		position: relative;
		display: flex;
		align-items: center;
		.title {
			width: 108px;
			height: 16px;
		}
		.close {
			width: 24px;
			height: 24px;
			position: absolute;
			right: 24px;
			cursor: pointer;
		}
	}
}
.detail_intro {
	margin-top: 16px;
	height: 150px;
	width: 100%;
	display: flex;
	align-items: flex-start;
	padding: 0 8px;
	box-sizing: border-box;
	img {
		width: 264px;
		height: 100%;
		border-radius: 2px;
		margin-right: 16px;
		object-fit: cover;
	}
	.intro {
		width: calc(100% - 280px);
		.name {
			color: #3fffff;
			font-size: 14px;
			font-weight: bold;
		}
		.info {
			margin-top: 14px;
			width: 100%;
			height: 114px;
			overflow-y: auto;
			color: #c9ffff;
			font-size: 14px;
			text-indent: 2rem;
		}
	}
}
.detail_stat {
	display: flex;
	align-items: center;
	flex-direction: column;
	padding: 0 8px;
	width: 100%;
	box-sizing: border-box;
	.stat_subtitle {
		height: 14px;
		margin-top: 20px;
	}
	.stat_line {
		height: 2px;
		width: 494px;
		margin: 10px 0;
	}
}
.stat_info {
	margin-top: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	&_item {
		margin-right: 100px;
		display: flex;
		align-items: flex-start;
		&:last-child {
			margin-right: 0;
		}
		img {
			width: 18px;
			height: 46px;
			margin-right: 8px;
		}
		.right {
			div {
				&:first-child {
					color: #3fffff;
					font-size: 14px;
				}
				&:last-child {
					color: #ffffff;
					font-size: 16px;
					font-weight: bold;
					margin-top: 8px;
				}
			}
		}
	}
}
.stat_type {
	margin-top: 20px;
	width: 490px;
	height: 80px;
	display: flex;
	align-items: center;
	background: url('../../image/icon_ul_bg.png') no-repeat;
	background-size: 100% 100%;
	.title {
		margin-left: 84px;
		margin-right: 24px;
		width: 28px;
		color: #ffffff;
		font-size: 14px;
	}
	.type_item {
		height: 24px;
		padding: 0 10px;
		line-height: 24px;
		font-size: 14px;
		color: #69f9fe;
		border-radius: 12px;
		border: 1px solid #69f9fe;
		margin-right: 12px;
		&:last-child {
			margin-right: 0;
		}
	}
}
.stat_table {
	margin-top: 2px;
	width: 100%;
	max-height: 144px;
	overflow-y: auto;
	&_cell {
		display: flex;
		align-items: center;
		color: #ffffff;
		font-size: 14px;
		height: 48px;
		width: 100%;
		padding: 0 16px;
		box-sizing: border-box;
		&:nth-child(2n - 1) {
			background-color: #e6f6ff10;
		}
		&:nth-child(2n) {
			background: linear-gradient(90deg, rgba(0, 112, 207, 0.1) 0%, rgba(0, 112, 207, 0.1) 100%);
		}
	}
	.table_header {
		color: #c9ffff;
	}
}
.stat_device {
	margin-top: 6px;
	display: -webkit-box;
	align-items: center;
	width: 100%;
	overflow-x: auto;
	.device_item {
		width: 186px;
		margin-right: 12px;
		color: #69f9fe;
		font-size: 14px;
		display: flex;
		align-items: center;
		flex-direction: column;
		&:last-child {
			margin-right: 0;
		}
		img {
			width: 100%;
			height: 140px;
			border-radius: 2px;
			margin-bottom: 12px;
		}
	}
}
</style>